<template>
  <div v-loading="ctx.loading">
    <MkBillPanel :bill="ctx.fanYinDengJi" ref="billPanelRef">
      <template #button>
        <MkButtonQueryHistory @click="listRef.open()" />
        <MkButtonAdd @click="newEntity" :isEdit="ctx.isEdit" />
        <MkButtonSubmit @click="submit" :loading="ctx.loading" :isEdit="ctx.isEdit" />
        <MkButtonMore>
          <a-menu-item @click="cancel">作废</a-menu-item>
          <a-menu-item @click="billPanelRef.showCaoZuo()">操作记录</a-menu-item>
        </MkButtonMore>
      </template>
      <template #info>
        <MkXueYeScanInput v-if="isLinChuang" />
        <MkForm class="mt10">
          <el-form-item label="血液信息">
            <MkTextXueYe style="padding: 0 0 0 20px;" />
          </el-form-item>
          <el-form-item label="患者信息">
            <MkPatient />
          </el-form-item>
        </MkForm>
      </template>
      <div>
        <MkPanelEdit title="临床登记">
          <MkForm formId="LinChuangFanYingDengJi" ref="linChuangRef" :col="3">
            <MkDatePicker label="输血时间" v-model="ctx.fanYinDengJi.shuXueShiJian" prop="shuXueShiJian"
              :isEdit="isLinChuang" />
            <MkSelect label="受血方式" v-model="ctx.fanYinDengJi.shouXueFangShi" :options="['静滴', '注射']"
              :isEdit="isLinChuang" />
            <MkSelectEdit label="反应发生时间" v-model="ctx.fanYinDengJi.fanYingFaShengShiJian" :isEdit="isLinChuang"
              :options="[{ title: '输血中', canEdit: false }, { title: '输血后', canEdit: false }, { title: '', canEdit: true }]" />
            <MkInputNumber label="实际输入量" v-model="ctx.fanYinDengJi.shuRuLiang" :isEdit="isLinChuang">
              <template #suffix>ml</template>
            </MkInputNumber>
            <MkSelect label="输血反应程度" v-model="ctx.fanYinDengJi.fanYingChengDu" :isEdit="isLinChuang"
              :options="['轻度', '中度', '重度']" />
            <el-row>
              <MkSelectUser label="护士" v-model="ctx.fanYinDengJi.huShiId" :isEdit="isLinChuang" />
              <MkSelectUser label="经治医生" v-model="ctx.fanYinDengJi.jingZhiYiShengId" :isEdit="isLinChuang" />
              <MkDatePicker label="填写时间" v-model="ctx.fanYinDengJi.tianXieShiJian" :isEdit="isLinChuang" />
            </el-row>
            <MkSelectEdit type="textarea" label="症状与体征" v-model="ctx.fanYinDengJi.zhengZhuangYuTiZheng" :col="2"
              :isEdit="isLinChuang" :options="zhengZhuangTiZhengOptions" multi
              selectId="traShuXueFanYing_zhengZhuangYuTiZheng" />
            <MkSelectEdit type="textarea" label="临床处理" v-model="ctx.fanYinDengJi.linChuangChuLi" :col="2"
              :isEdit="isLinChuang" :options="linChuangChuLiOptions" multi selectId="traShuXueFanYing_linChuangChuLi" />
            <MkSelectEdit type="textarea" label="临床初步诊断" v-model="ctx.fanYinDengJi.linChuangChuBuZhenDuan" :col="2"
              :isEdit="isLinChuang" :options="linChuangZhenDuanOptions" multi
              selectId="traShuXueFanYing_linChuangChuBuZhenDuan" />
          </MkForm>
        </MkPanelEdit>
        <MkPanelEdit title="输血科处理">
          <MkForm formId="ShuXueKeFanYingDengJi" ref="shuXueKeRef" :col="3">
            <MkInput type="textarea" label="输血科处理" v-model="ctx.fanYinDengJi.shuXueKeChuLi" :col="2"
              :isEdit="!isLinChuang" />
            <MkInput type="textarea" label="诊断" v-model="ctx.fanYinDengJi.shuXueKeZhenDuan" :col="2"
              :isEdit="!isLinChuang" />
            <MkInput type="textarea" label="建议和整改措施" v-model="ctx.fanYinDengJi.jianYiCuoShi" :col="2"
              :isEdit="!isLinChuang" />
          </MkForm>
        </MkPanelEdit>
      </div>
    </MkBillPanel>
    <ListPage ref="listRef" />
  </div>
</template>

<script lang='ts' setup name="traShuXueFanYing">
import ListPage from './list.vue'
import { isLinChuang } from '/@/stores/baseInfo'
interface fanYin extends BillEntityType {
  shuXueShiJian?: string
  shouXueFangShi: string
  fanYingFaShengShiJian: string
  shuRuLiang: number
  fanYingChengDu: string
  huShiId: Number
  jingZhiYiShengId: Number
  tianXieShiJian: string
  zhengZhuangYuTiZheng: string
  linChuangChuLi: string
  linChuangChuBuZhenDuan: string
  shuXueKeChuLi: string
  shuXueKeZhenDuan: string
  jianYiCuoShi: string
}
const zhengZhuangTiZhengOptions = [
  { "title": "", "canEdit": true },
  { "title": "发热", "canEdit": false },
  { "title": "发绀", "canEdit": false },
  { "title": "荨麻疹", "canEdit": false },
  { "title": "呼吸困难", "canEdit": false },
  { "title": "心功能衰竭", "canEdit": false },
  { "title": "负荷过重", "canEdit": false },
  { "title": "肺部并发症", "canEdit": false },
  { "title": "两肺布满湿性啰音", "canEdit": false },
  { "title": "黄疸", "canEdit": false },
  { "title": "腰背痛", "canEdit": false },
  { "title": "酱油色尿", "canEdit": false },
  { "title": "咯大量血性泡沫样痰", "canEdit": false },
  { "title": "寒战", "canEdit": false },
  { "title": "颈静脉怒张", "canEdit": false },
  { "title": "休克", "canEdit": false },
  { "title": "皮肤充血", "canEdit": false },
  { "title": "伤口渗血不止", "canEdit": false },
  { "title": "头晕", "canEdit": false },
  { "title": "头疼", "canEdit": false },
  { "title": "恶心", "canEdit": false },
  { "title": "呕吐", "canEdit": false },
  { "title": "胸闷", "canEdit": false },
  { "title": "畏寒", "canEdit": false },
  { "title": "血尿", "canEdit": false },
  { "title": "皮肤瘙痒", "canEdit": false },
  { "title": "肢体麻木", "canEdit": false },
  { "title": "四肢发冷", "canEdit": false },
  { "title": "眼睑口唇水肿", "canEdit": false }
]
const linChuangChuLiOptions = [
  { "title": "", "canEdit": true },
  { "title": "立即停止输血，保留静脉通路", "canEdit": false },
  { "title": "保暖", "canEdit": false },
  { "title": "吸氧", "canEdit": false },
  { "title": "降温", "canEdit": false },
  { "title": "抗过敏", "canEdit": false },
  { "title": "激素", "canEdit": false },
  { "title": "升压", "canEdit": false },
]
const linChuangZhenDuanOptions = [
  { "title": "", "canEdit": true },
  { "title": "发热反应", "canEdit": false },
  { "title": "过敏反应", "canEdit": false },
  { "title": "急性溶血反应", "canEdit": false },
  { "title": "添加输血相关急性肺损伤", "canEdit": false },
  { "title": "输血相关移植物抗宿主病", "canEdit": false },
  { "title": "输血后紫癜", "canEdit": false },
  { "title": "发热反应分为感染性发热", "canEdit": false },
  { "title": "非感染性发热", "canEdit": false },
]
const initState = () => {
  return {
    loading: false,
    isEdit: false,
    fanYinDengJi: {} as fanYin,
  }
}
const ctx = reactive(initState())
const billPanelRef = ref()
const listRef = ref()

const newEntity = () => {

}

const submit = () => {

}

const cancel = () => {

}

</script>

<style lang='scss' scoped></style>